﻿using System;
using System.Text;

namespace KagSharp.Expressions
{
    public class ParameterExpression : IdentifierExpression
    {
    	private IExpression _Value;
    	public IExpression Value { get{return _Value;}set{_Value = value;} }

        public ParameterExpression(string name, IExpression value) : base(name)
        {
            Value = value;
        }

        public override void Print(StringBuilder sb, bool verbose, int indentLevel)
        {
            sb.Append(Name);

            if (Value != null)
            {
                sb.Append("=");
                Value.Print(sb, verbose, 0);
            }
        }

        public override TR Accept<TR>(IExpressionVisitor<TR> visitor, string context) {
        	return visitor.Visit(this, context);}

        public override Type ValueType {get{return Value.ValueType;}}

        public override string ToString() {return "ParameterExpression: " + Name;}
    }
}
